<template>
    <div class="deposit-record">
        <TopTitleExit title="Deposit Record" :exit="routerExit"></TopTitleExit>
        <div class="list">
            <div class="item" v-for="item in depositList" :key="item.id">
                <div class="top">
                    <div class="date">{{ format_utc5(item.createTime * 1000) }}</div>
                    <div class="status" :style="`color: ${ depositType[item.status].tc }`">{{ depositType[item.status].text }}</div>
                </div>
                <div class="main">
                    <div class="symbol-box">
                        <div class="icon" style="--icon: url(/network/USDT.svg)"></div>
                        <div class="symbol">USDT-ERC20</div>
                    </div>
                    <div class="price">${{ item.amount }}</div>
                </div>
                <div class="bottom">Remark:--</div>
            </div>
        </div>
    </div>
</template>

<script setup>
import TopTitleExit from '@/components/common/TopTitleExit.vue';
import { loading } from '@/service/status';
import { routerExit } from '@/utils/jump';
import { format_utc5 } from '@/utils/time';
import { onMounted } from 'vue';
import { depositService, depositList } from '@/service/deposit';

// const depositType = {
//     0: {
//         text: 'Pending',
//         bg: '#fef9c3',
//         tc: '#854d0e',
//     },
//     1: {
//         text: 'Approved',
//         bg: '#dcfce7',
//         tc: '#166534',
//     },
//     2: {
//         text: 'Success',
//         bg: '#dcfce7',
//         tc: '#166534',
//     },
//     3: {
//         text: 'Rejected',
//         bg: '#fee2e2',
//         tc: '#991b1b',
//     },
// };
const depositType = {
    0: {
        text: 'Pending',
        bg: '#fef9c3',
        tc: 'var(--negative-number-color)',
    },
    1: {
        text: 'Approved',
        bg: '#dcfce7',
        tc: 'var(--positive-number-color)',
    },
    2: {
        text: 'Success',
        bg: '#dcfce7',
        tc: 'var(--positive-number-color)',
    },
    3: {
        text: 'Rejected',
        bg: '#fee2e2',
        tc: 'var(--negative-number-color)',
    },
};

onMounted(async () => {
    loading.value = true;
    await depositService.getDepositList();
    loading.value = false;
});
</script>

<style scoped lang="less">
.deposit-record {
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;

    .list {
        box-sizing: border-box;
        width: 100%;
        flex: 1;
        overflow-y: auto;
        padding: 3vw;

        .item {
            box-sizing: border-box;
            width: 100%;
            padding: 3vw;
            border-radius: 2vw;
            box-shadow: 0 0 3vw rgba(0, 0, 0, 0.1);
            display: flex;
            flex-direction: column;
            gap: 3vw;

            .top {
                display: flex;
                justify-content: space-between;
                align-items: center;

                .date {
                    font-size: 3.3vw;
                    color: var(--text-color);
                }

                .status {
                    font-size: 3.5vw;
                    font-weight: 500;
                    color: var(--positive-number-color);
                }
            }

            .main {
                display: flex;
                justify-content: space-between;
                align-items: center;

                .symbol-box {
                    display: flex;
                    align-items: center;
                    gap: 1.5vw;

                    .icon {
                        --size: 5vw;
                        --w: var(--size);
                        --h: var(--size);
                    }

                    .symbol {
                        font-size: 3.5vw;
                        font-weight: 500;
                        color: var(--text-color);
                    }
                }

                .price {
                    font-size: 3.5vw;
                    font-weight: 500;
                    color: var(--text-light-color);
                }
            }

            .bottom {
                font-size: 3vw;
                color: var(--text-color);
            }
        }
    }
}
</style>